package net.cloudcodex.client.widgets;

import com.google.gwt.user.client.ui.DockPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.TextBox;


public class CharacterAvatar extends Avatar {
	
	private String alias ;
	private boolean isActiveCharacter;
	
	public CharacterAvatar() {
		super();
	}

	public CharacterAvatar(String imageURL, String name) {
		this();
		initComponent(imageURL, name, true);
	}

	public CharacterAvatar(String imageURL, String name, boolean withName) {
		this();
		initComponent(imageURL, name, withName);
	}

	public void initComponent(String imageURL, String name, boolean withName) {

		setImageURL(imageURL);
		setName(name);
		defaultImageURL();
		setWithName(withName);
		init();
		setIconeStyleName("caractereIconeAvatar");
		setNameStyleName("characterNameAvatar");
	}
	
	
	
	@Override
	protected void defaultImageURL() {
		setDefaultImageURL("images/avatar/character/default.png");

	}
	
	public void initAliasPanel(String alias) {
		this.alias = alias ;
		DockPanel panel = new DockPanel();
		Label aliasLabel = new Label();
		aliasLabel.setText("Alias : ");
		panel.add(aliasLabel,DockPanel.NORTH);
		TextBox aliasTextBox = new TextBox();
		aliasTextBox.setEnabled(false);
		aliasTextBox.setText(alias);
		panel.add(aliasTextBox,DockPanel.CENTER);
		this.add(panel);

	}

	public void isActiveCharacter(boolean isActiveCharacter) {
		this.isActiveCharacter = isActiveCharacter ;
	}

	public void initComponent(String imageURL, String name) {
		this.initComponent(imageURL, name, true);
	}

}
